<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #div3{
      width: 50px;
      height: 50px;
      background-color: gold;
    }
    #div2{
      width: 100px;
      height: 100px;
      background-color: greenyellow;
    }
    #div1{
      width: 150px;
      height: 150px;
      background-color: hotpink;
    }
  </style>
</head>
<body>
  
  <div id="div1">div1
    <div id="div2">div2
      <div id="div3">div3</div>
    </div>
  </div>
  
  <script>
    var div1 = document.getElementById("div1");
    var div2 = document.getElementById("div2");
    var div3 = document.getElementById("div3");

    div1.onclick = function() {
      console.log("This is div1");
    };
    
    div2.onclick = function() {
      console.log("This is div2");
    };

    div3.onclick = function() {
      console.log("This is div3");
    };
  </script>

</body>
</html>